home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lsof_3.37 / 00FAQ < prev    next >
Encoding:
Text File  |  1995-08-01  |  32.4 KB  |  904 lines

  1.  
  2.         Frequently Asked Questions about lsof
  3.  
  4. **********************************************************************
  5. | The latest release of lsof is always available via anonymous ftp   |
  6. | from vic.cc.purdue.edu.  Look in pub/lsof.README for its location. |
  7. **********************************************************************
  8.  
  9. ______________________________________________________________________
  10.  
  11. This file contains frequently asked questions about lsof and answers
  12. to them.
  13.  
  14. Vic Abell
  15. July 26, 1995
  16. ______________________________________________________________________
  17.  
  18. Table of Contents:
  19.  
  20. 1.0    General Concepts
  21. 1.1    Lsof -- what is it?
  22. 1.2    Where do I get lsof?
  23. 1.2.1    Are there mirror sites?
  24. 1.2.2    Are lsof executables available?
  25. 1.2.3    Why can't I extract the lsof tar files?
  26.  
  27. 2.0    Lsof Ports
  28. 2.1    What ports exist?
  29. 2.2    What about a new port?
  30. 2.2.1    User-contributed Ports
  31. 2.2.2    Dell SVR4
  32. 2.3    Why isn't there an AT&T SVR4 port?
  33.  
  34. 3.0    Lsof Problems
  35. 3.1    Why doesn't lsof report full path names?
  36. 3.2    Does lsof have security problems?
  37. 3.3    Will lsof show remove hosts using files via NFS?
  38. 3.4    My Sun gcc-compiled lsof doesn't work -- why?
  39. 3.4.1    How can I make lsof compile with gcc under Solaris 2.4?
  40. 3.4.2    How can I make lsof compile with gcc under SunOS 4.1.x?
  41. 3.4.3    Why does the Solaris SunPRO cc complain about system header files?
  42. 3.5    How do I compile lsof on a previous revision of Pyramid DC/OSx?
  43. 3.6    AIX Problems
  44. 3.6.1    How can I compile a working lsof for AIX 4.1?
  45. 3.6.2    What is the Stale Segment ID bug and why is -X needed?
  46. 3.6.2.1    Stale Segment ID APAR
  47. 3.7    Why doesn't lsof display open IRIX 5.3 XFS files properly?
  48. 3.8    Where is the IRIX 5.3 <sys/vnode.h>?
  49. 3.9    Why does an HP-UX lsof compilation get ``unknown "O" option?''
  50. 3.10    Why doesn't a NetBSD 1.0A binary run on my 1.0A system?
  51. 3.11    Why does an asterisk (`*') precede some inode numbers?
  52.  
  53. 4.0    Lsof Features
  54. 4.1     Why doesn't lsof doesn't report on /proc entries on my
  55.     system?
  56. 4.2    How do I disable the device cache file feature or alter
  57.     it's behavior?
  58.  
  59. 5.0    Linux
  60. 5.1    Why doesn't lsof work (or even compile) on my Linux system?
  61. 5.2    Why does lsof complain about /dev/kmem?
  62. 5.3    Why can't lsof find kernel addresses?
  63. 5.4    Where is /zSystem.map (or /System.map)?  Why doesn't it match
  64.     my kernel?
  65. ______________________________________________________________________
  66.  
  67. 1.0    General Concepts
  68.  
  69. 1.1    Lsof -- what is it?
  70.  
  71.     Lsof is a Unix-specific tool.  It's name stands for LiSt
  72.     Open Files, and it does just that.  It lists information
  73.     about files that are open by the processes running on a
  74.     Unix system.
  75.  
  76.     See the lsof man page, the 00DIST file, and the 00README
  77.     file of the lsof distribution for more information.
  78.  
  79. 1.2    Where do I get lsof?
  80.  
  81.     Lsof is available via anonymous ftp from vic.cc.purdue.edu
  82.     (128.210.15.16).  Look in the pub/tools/unix/lsof sub-
  83.     directory.
  84.  
  85.     Compressed and gzip'd tar files with PGP certificates are
  86.     available.
  87.  
  88. 1.2.1    Are there mirror sites?
  89.  
  90.     The lsof distribution is currently mirrored at:
  91.  
  92.         coast.cs.purdue.edu
  93.             pub/tools/unix/lsof
  94.         ftp.auscert.org.au
  95.             /pub/mirrors/vic.cc.purdue.edu/lsof/*
  96.         ftp.cert.dfn.de
  97.             /pub/tools/misc
  98.         ftp.cs.columbia.edu
  99.             archives/lsof/
  100.         ftp.fu-berlin.de
  101.             pub/unix/tools/lsof
  102.         ftp.gre.ac.uk
  103.             pub/tools/lsof
  104.         ftp.rge.com
  105.             /pub/lsof
  106.         ftp.sterling.com
  107.             /admin-tools/lsof
  108.         ftp.sunet.se
  109.             pub/unix/admin/lsof
  110.         ftp.tau.ac.il
  111.             /pub/sources/admin
  112.         wuarchive.wustl.edu
  113.             /packages/security/lsof
  114.  
  115. 1.2.2    Are lsof executables available?
  116.  
  117.     Some lsof executables are available in the subdirectory
  118.     tree pub/tools/unix/lsof/binaries  These are neither guaranteed
  119.     to be current nor cover every dialect and machine architecture.
  120.  
  121.     I don't recommend you use pre-compiled lsof binaries; I
  122.     recommend you obtain the sources and build your own binary.
  123.     Even if you're a Sun user without a SunPRO C compiler, you
  124.     can use gcc to compile lsof.
  125.  
  126.     If you must use a binary file, please be conscious of the
  127.     security implications in using an executable of unknown
  128.     origin.  The lsof binaries are accompanied by PGP certificates.
  129.     Please use them!
  130.  
  131. 1.2.3    Why can't I extract the lsof tar files?
  132.  
  133.     I have had a report from a Solaris user that he was unable
  134.     to extract the lsof distribution file under Solaris 2.3 or
  135.     2.4.  I was able to duplicate his report.
  136.  
  137.     When I upgraded tar on my NeXT cube (where I generate the
  138.     lsof distribution) to GNU tar 1.11.2 (plus some local
  139.     fixes), I could no longer duplicate the problem.
  140.  
  141.     The Solaris user still reports that he can extract the GNU-
  142.     tar-1.11.2-built archive, but gets warning messages from
  143.     tar.  I get no warning messages, so we jointly suspect that
  144.     it's possible some Sun patch has made our two tar programs
  145.     somewhat incompatible.
  146.  
  147.     If you have problems extracting the lsof distribution,
  148.     please try GNU tar 1.11.2 or later.  If that fails, contact
  149.     me.
  150.  
  151. 2.0    Lsof Ports
  152.  
  153. 2.1    What ports exist?
  154.  
  155.     The pub/lsof.README file carries the latest port information:
  156.  
  157.     AIX 3.2.[45], 4.1, 4.1.1, and    IBM RISC/System 6000
  158.         4.1.2
  159.     DC/OSx 1.1            Pyramid ES, Nile, and S
  160.     EP/IX 2.1.1            CDC 4680
  161.     FreeBSD 1.1.5.1, 2.0, and    Intel-based systems
  162.         2.0.5
  163.     HP-UX 8.x, 9.x, 10        HP
  164.     IRIX 4.0.5, 5.2, 5.3, and 6.0    SGI
  165.     Linux through 1.2.11        Intel-based systems
  166.     NetBSD 1.0 and 1.0A        Intel and SPARC-based systems
  167.     NEXTSTEP 2.1 and 3.[0123]    all NEXTSTEP architectures
  168.     Novell UnixWare 1.1, 1.1.1,    Intel-based systems
  169.         and 1.1.2
  170.     OSF/1 1.3, 2.0, 3.0, and 3.2    DEC Alpha
  171.     RISC/os 4.52            MIPS R2000-based systems
  172.     SCO OpenDesktop, OpenServer    Intel-based systems
  173.         1.1, 3.0, and 5.0
  174.     Sequent Dynix 3.0.12        Sequent Symmetry
  175.     Sequent PTX 2.1.[156] and    Sequent systems
  176.         4.0.[23]
  177.     Solaris 2.[1234]        Sun 4 and i86pc
  178.     SunOS 4.1.3            Sun 3 and 4
  179.     Ultrix 2.2, 4.2, 4.3, and 4.4    DEC RISC and VAX
  180.     V/88 R32V3, R40V4.2, and    Motorola M88K
  181.         R40V4.3
  182.  
  183. 2.2    What about a new port?
  184.  
  185.     The 00PORTING file in the distribution gives hints on doing
  186.     a port.  (An lsof port is not for the faint of heart.)  It
  187.     has been done -- witness Anthony Shortland's Pyramid DC/OSx
  188.     port.  He started with the Novell UnixWare port and needed
  189.     to make but a few changes; you might consider starting
  190.     there, too, if you want to try your hand at porting lsof
  191.     to a new Unix dialect.
  192.  
  193.     I will consider doing a port in exchange for permanent
  194.     access to a test host.  I require permanent access so I
  195.     can test new lsof revisions, because I will not offer
  196.     distributions of dialect ports I cannot upgrade and test.
  197.  
  198. 2.2.1    User-contributed Ports
  199.  
  200.     Sometimes I receive contributions of ports of lsof to
  201.     systems where I can't test future revisions of lsof.  Hence,
  202.     I don't incorporate these contributions into my lsof
  203.     distribution.
  204.  
  205.     However, I do make these contributions available in the
  206.     directory:
  207.  
  208.         pub/tools/unix/lsof/contrib
  209.  
  210.     on my ftp server, vic.cc.purdue.edu.
  211.  
  212.     Consult the 00INDEX file in the contrib/ directory for a
  213.     list of the available contributions.
  214.  
  215. 2.2.2    Dell SVR4
  216.  
  217.     There is no lsof port for Dell SVR4.  However, Kevin Kadow
  218.     <kadokev@rci.ripco.com reports that he has been able to
  219.     use the UnixWare version of lsof under Dell SVR4.  Kevin
  220.     did not compile lsof from sources, but used the binary made
  221.     available through the Novell mail server (see 00README for
  222.     details).  A UnixWare binary is also available via anonymous
  223.     ftp from vic.cc.purdue.edu in pub/tools/unix/lsof/binaries/novell.
  224.  
  225. 2.3    Why isn't there an AT&T SVR4 port?
  226.  
  227.     I haven't produced an AT&T SVR4 port because I haven't seen
  228.     a Unix dialect that is strictly limited to the AT&T System
  229.     V, Release 4 source code.  Every one I have seen is a
  230.     derivative with vendor additions.
  231.  
  232.     The vendor additions are significant to lsof because they
  233.     affect the internal kernel structures with which lsof does
  234.     business.  While some vendor derivatives of SVR4 are similar,
  235.     each one I have encounted so far has been different enough
  236.     from its siblings to require special source code.
  237.  
  238.     If you're interested in an SVR4 version of lsof, here are
  239.     some existing ports you can consider:
  240.  
  241.         DC/OSx 1.1
  242.         EP/IX 2.1.1
  243.         IRIX 5.2, 5.3, and 6.0
  244.         Sequent PTX 4.0.[23]
  245.         Solaris 2.[1234]
  246.         UnixWare 1.1, 1.1.1, and 1.1.2
  247.         V/88 R40V4.2 and R40V4.3
  248.  
  249.  
  250. 3.0    Lsof Problems
  251.  
  252. 3.1    Why doesn't lsof report full path names?
  253.  
  254.     Lsof reports full path names in two, limited cases: 1) some
  255.     systems, e.g., some IRIX and SunOS versions, contain full
  256.     directory path names in their user structure, so lsof
  257.     reports those; or 2) lsof reports the full path name when
  258.     it is specified as a search argument for open files that
  259.     match it.
  260.  
  261.     As of revision 3.19 lsof reports some path name components
  262.     (e.g., the proc.h component of /usr/include/sys/proc.h)
  263.     for these dialects:
  264.  
  265.         DEC OSF/1 2.0, 3.0, and 3.2
  266.         Dynix (Purdue 3.0.12)
  267.         EP/IX 2.1.1
  268.         FreeBSD 1.1.5.1, 2.0, and 2.0.5
  269.         HP-UX 9.01
  270.         Motorola V/88 R40V4.2 (but not R32V3)
  271.         NetBSD 1.0 and 1.0A
  272.         NEXTSTEP 3.1
  273.         RISC/os 4.52
  274.         SGI IRIX 5.3
  275.         Solaris 2.[34]
  276.         SunOS 4.1.[23]
  277.         Ultrix 2.2, 4.2, and 4.3 (last component only)
  278.  
  279.     (For an up-to-date list of dialects with path name component
  280.     reporting consult the KERNEL NAME CACHE section of the lsof
  281.     man page.)
  282.  
  283.     Lsof obtains the components from the kernel's name cache.
  284.     Since the size of the cache is limited and the cache is in
  285.     constant flux, it does not always contain the names of all
  286.     components in an open file's path; sometimes it contains
  287.     none of them.
  288.  
  289.     Lsof reports the file system directory name and whatever
  290.     components of the file's path it finds in the cache, starting
  291.     with the last component and working backwards through the
  292.     directories that contain it.  If lsof finds no path
  293.     components, lsof reports the file system device name instead.
  294.  
  295.     When lsof does report some path components in the NAME
  296.     column, it prefixes them with the file system directory
  297.     name, followed by " -- ", followed by the components --
  298.     e.g., /usr -- sys/path.h for /usr/include/sys/path.h.
  299.  
  300.     Lsof can't obtain path name components from the kernel name
  301.     caches of the following dialects:
  302.  
  303.         AIX                 The knlist() function won't return
  304.                 cache addresses -- some IBM wisdom
  305.                 to "protect" their customers.
  306.  
  307.         Linux               It doesn't seem to have a kernel name
  308.                 cache.
  309.  
  310.         Motorola V/88    It doesn't have a unified name cache.
  311.              R32V3
  312.  
  313.         Novell UnixWare    I don't have a test system.
  314.  
  315.         Pyramid DC/OSx    I don't have a test system.
  316.  
  317.         SCO OpenDesktop    It doesn't have a unified name cache.
  318.         OpenServer
  319.     
  320.         SGI IRIX 4.0.5H    I saw no unified name cache in the
  321.                 header files.
  322.  
  323.         SGI IRIX 5.2 and    The name cache is not visible to
  324.              6.0    application programs.
  325.  
  326.         Novell UnixWare    I don't have a test system.
  327.  
  328.     The effort of reporting full path names is expensive.  No
  329.     Unix kernel records full path names in the structures it
  330.     records about open files; instead, kernels convert path
  331.     names to device and inode number doublets and use them for
  332.     subsequent file references once files have been opened.
  333.  
  334.     To convert the device and inode number doublet into a
  335.     complete path name, lsof would have to start at the root
  336.     node (root directory) of the file system on which the inode
  337.     resides, and search every branch for the inode, building
  338.     possible path names along the way.  That would be a time
  339.     consuming operation and require access to the raw disk
  340.     device (usually implying setuid(root) permission).
  341.  
  342.     If the prospect of that much disk activity doesn't concern
  343.     you, think about the cost when the device is NFS-mounted.
  344.  
  345. 3.2    Does lsof have security problems?
  346.  
  347.     I don't think so.  However, lsof does usually have setgid(kmem)
  348.     permission or the equivalent.  In some SYSV systems it has
  349.     setuid(root) permission to access /proc file system entries.
  350.     Any program that has setgid or setuid permission should
  351.     always be regarded suspiciously.
  352.  
  353.     The setgid or setuid power leads to a potential security
  354.     problem.  It could allow lsof to read a kernel name list
  355.     or memory file via the -c and -k options.  To circumvent
  356.     this problem lsof (revisions 3.07 and above) uses access(2)
  357.     to determine its real UID's authority to read files declared
  358.     with -c and -k.  My thanks to Tim Ramsey <tar@ksu.ksu.edu>
  359.     for identifying this problem.
  360.  
  361.     The device cache file (typically /tmp/.lsof_dev_cache) has
  362.     0666 modes.  However, even when lsof runs setuid(root), it
  363.     makes sure the file's ownerships are changed to that of
  364.     the real user and group.  In addition, lsof checks the file
  365.     carefully before using it (see section 4.2 for a description
  366.     of the checks); discards the file if it fails the scrutiny;
  367.     complains about the condition of the file; then rebuilds
  368.     the file.
  369.  
  370.  
  371. 3.3    Will lsof show remote hosts using files via NFS?
  372.  
  373.     No.  Remember, lsof displays open files for the processes
  374.     of the host on which it runs.  If the host on which lsof
  375.     is running is an NFS server, the remote NFS client processes
  376.     that are accessing files on the server leave no process
  377.     records on the server for lsof to examine.
  378.  
  379. 3.4    My Sun gcc-compiled lsof doesn't work -- why?
  380.  
  381.     Gcc can be used to build lsof successfully.  However, an
  382.     improperly installed Sun gcc compiler will usually not
  383.     produce a working lsof.
  384.  
  385.     Under SunOS 4.1.x this may happen when the gcc compiler is
  386.     copied from one Sun architecture -- e.g., from a sun4m to
  387.     a sun4.  The problem comes from the copying of the special
  388.     #include header files that gcc "fixes" during installation
  389.     to circumvent ANSI-C conflicts, especially on #else and
  390.     #endif pre-processor declarations.  Some of the "fixed"
  391.     header files declare kernel structures whose length varies
  392.     with architecture type.  In particular, the size of the
  393.     user structure (<sys/user.h>) changes with architecture
  394.     type, and, since lsof gets command name and file pointers
  395.     from that structure, can cause lsof to malfunction when
  396.     its length is incorrect.
  397.  
  398.     These architecture-related structure differences changes
  399.     do not seem to occur under Solaris.  Instead, the more
  400.     common reason a gcc-compiled lsof doesn't work there is
  401.     that the special gcc header files were not updated during
  402.     the change from one version Solaris to the next -- e.g.,
  403.     from 2.3 to 2.4.
  404.  
  405.     If your Sun gcc-compiled lsof doesn't report anything,
  406.     check that the gcc "fixincludes" step was run on the system
  407.     where you're using gcc to compile lsof.
  408.  
  409. 3.4.1    How can I make lsof compile with gcc under Solaris 2.4?
  410.  
  411.     Presuming your gcc-specific header files are wrong for
  412.     Solaris, edit the lsof Configure-generated Makefile and
  413.     change:
  414.  
  415.         CFGF=   -Dsolaris=20400
  416.     to
  417.         CFGF=   -Dsolaris=20400 -D__STDC__=0 -I/usr/include
  418.  
  419.     This is only a temporary work-around.  You really should
  420.     rerun gcc's fixincludes scripts to update your gcc-specific
  421.     header files.
  422.  
  423. 3.4.2    How can I make lsof compile with gcc under SunOS 4.1.x?
  424.  
  425.     Presuming your gcc-specific header files are wrong for
  426.     SunOS 4.1.x, edit the lsof Configure-generated Makefile
  427.     and change:
  428.  
  429.         CFGF=   -ansi -DSUNOSV=40103
  430.     to
  431.         CFGF=   -DSUNOSV=40103 -I/usr/include
  432.  
  433.     This is only a temporary work-around.  You really should
  434.     rerun gcc's fixincludes scripts to update your gcc-specific
  435.     header files.
  436.  
  437. 3.4.3    Why does the Solaris SunPRO cc complain about system header files?
  438.  
  439.     You're probably trying to use /usr/ucb/cc if you get compiler
  440.     complaints like:
  441.  
  442.         cc -O -DCANDOCHILD -Dsun -Dsolaris=20300 ...
  443.         "/usr/include/sys/machsig.h", line 81: macro BUS_OBJERR
  444.         redefines previous macro at "/usr/ucbinclude/sys/signal.h",
  445.         line 444
  446.  
  447.     Note the reference to "/usr/ucbinclude/sys/signal.h".  It
  448.     reveals that the BSD Compatibility Package C compiler is
  449.     in use.  Lsof requires the ANSI C version of the Solaris
  450.     C compiler, usually found in /usr/opt/bin/cc or
  451.     /opt/SUNWspro/bin/cc.
  452.  
  453.     Try adding a CC string to the lsof Makefile that points to
  454.     the Sun ANSI C version if the SunPRO C compiler -- e.g.,
  455.  
  456.         CC= /usr/opt/bin/cc
  457.     or
  458.         CC= /opt/SUNWspro/bin/cc.
  459.  
  460. 3.5    How do I compile lsof on a previous version of Pyramid DC/OSx?
  461.  
  462.     If you are running a version of Pyramid DC/OSx earlier than
  463.     the ones on which lsof was developed -- 1.1-94c079 or
  464.     1.1-94d079 -- you may find that your compiler complains
  465.     that the mntent.h and mnttab.h header files are missing.
  466.  
  467.     If you can "borrow" those header files from a later version
  468.     of DC/OSx, you may be able to compile and use lsof.  Robert
  469.     Vernon <bob@pyramid.com.au> reports he used this strategy
  470.     successfully on an ES series machine, running DC/OSx
  471.     1.1-93c063.
  472.  
  473. 3.6    AIX Problems
  474.  
  475. 3.6.1    How can I compile a working lsof for AIX 4.1?
  476.  
  477.     If you have updated your AIX system to 4.1, but haven't
  478.     updated your xlc compiler, the lsof you compile may not
  479.     work.  This is caused by the new -qlonglong or -qlongdouble
  480.     default option to xlc; it causes the _LONG_LONG symbol to
  481.     be defined; _LONG_LONG causes a slight change in the size
  482.     of the user structure from <sys/user.h>; and the size of
  483.     the user structure is important to lsof when it issues the
  484.     undocumented getuser() call, because getuser() fails when
  485.     the size of the user structure is stated incorrectly.
  486.  
  487.     You can tell if your compiler has been updated by using
  488.     the xlc command without options.  Called that way xlc will
  489.     show you the options it supports.  If -qlonglong or
  490.     -qlongdouble aren't among them, your compiler is not
  491.     sufficiently up to date.
  492.  
  493.     There is an easy work-around: add -D_LONG_LONG to the CFGF
  494.     string in the Makefile.  Change
  495.  
  496.         CFGF=   -D_AIXV=4100
  497.     to
  498.         CFGF=   -D_AIXV=4100 -D_LONG_LONG
  499.  
  500. 3.6.2    What is the Stale Segment ID bug and why is -X needed?
  501.  
  502.     Kevin Ruderman <rudi@acs.bu.edu> reports that he has been
  503.     informed by IBM that processes using the AIX 3.2.x and
  504.     4.1[.x] kernel's readx() function can cause other AIX
  505.     processes to hang because of what appears to be file system
  506.     corruption.
  507.  
  508.     This failure, known as the Stale Segment ID bug, is caused
  509.     by an error in the AIX kernel's journalled segment memory
  510.     handler that causes the kernel's dir_search() function
  511.     erroneously to believe directory entries contain zeroes.
  512.     The process using the readx() call need not be doing anything
  513.     wrong.  Usually the system must be under such heavy load
  514.     that the segment ID being used in the readx() call has been
  515.     freed and then reallocated to another process since it was
  516.     obtained from kernel memory.
  517.  
  518.     Lsof uses the readx() function to access library entry
  519.     structures, based on the segment ID it finds in the proc
  520.     structure of a process.  Since IBM has indicated they will
  521.     not fix the kernel bug in AIX 3.2.x or 4.1[.x] and may not
  522.     fix it until some version of 4.2, I've added an AIX-specific
  523.     option to lsof that controls its use of the readx() function.
  524.  
  525.     By default lsof readx() use is disabled; specifying the
  526.     ``-X'' option enables readx() use.  When readx() use is
  527.     disabled, lsof will report that in the NAME column for AIX
  528.     3.2.x and 4.1 text and loader references whose loader entry
  529.     structures must be obtained using readx().  (Lsof won't
  530.     report anything for AIX 4.1.x text and loader references
  531.     when readx() use is disabled.)  If lsof encounters an AIX
  532.     3.2.x or 4.1 loader entry that it can't read because readx()
  533.     use is disabled, it stops reporting loader entry information,
  534.     since loader entries are linked by pointer elements.
  535.  
  536.     If you want to change the default readx() behavior of AIX
  537.     lsof, change the HASXOPT and HASXOPT_VALUE definitions in
  538.     dialects/aix/machine.h.  You can also use these definitions
  539.     to enable or disable readx() use permanently -- consult
  540.     the comments in machine.h.  You may want to disable readx()
  541.     use permanently if you plan to make lsof publicly executable.
  542.  
  543.     I have never seen lsof cause this problem, but I believe
  544.     there is some chance it could, given the right circumstances.
  545.  
  546. 3.6.2.1    Stale Segment ID APAR
  547.  
  548.     Here are the details of the Stale Segment ID bug and IBM's
  549.     response, provided by Kevin Ruderman <rudi@acs.bu.edu>.
  550.  
  551.     AIX V3
  552.       APAR=ix49183
  553.           user process hangs forever in kernel due to file
  554.           system corruption
  555.       STAT=closed prs  TID=tx2527 ISEV=2 SEV=2
  556.            (A "closed prs" is one closed with a Permanent
  557.            ReStriction.)
  558.       RCOMP=575603001 aix v3 for rs/6 RREL=r320
  559.  
  560.     AIX V4  (internal defect, no apar #)
  561.       prefix        p
  562.       name          175671
  563.       abstract      KERMP: loop for ever in dir_search()
  564.  
  565.     Problem description:
  566.  
  567.     1. Some user application -- e.g., lsof -- gets the segment
  568.        ID (SID) for the process private segment of a target
  569.        process from the process table.
  570.  
  571.     2. The target process exits, deleting the process private
  572.        segment.
  573.  
  574.     3. The SID is reallocated for use as a persistent segment.
  575.  
  576.     4. The user application runs again and tries to read the
  577.        user area structure from /dev/mem, using the SID it read
  578.        from the process table.
  579.  
  580.     5. The loads done by the driver for /dev/mem cause faults
  581.        in the directory; new blocks are allocated; the size
  582.        changed; and zero pages created.
  583.  
  584.     6. The next application that looks for a file in the affected
  585.        directory hangs in the kernel's dir_search() function
  586.        because of the zero pages.  This occurs because the
  587.        kernel's dir_search() function loops through the variable
  588.        length entries one at a time, moving from one to the
  589.        next by adding the length of the current entry to its
  590.        address to get the address of the next entry. This
  591.        process should end when the current pointer passes the
  592.        end of the known directory length.
  593.  
  594.        However, while the directory length has increased, the
  595.        entry length data has not, so when dir_search() reaches
  596.        the zero pages, it loops forever, adding a length of
  597.        zero to the current pointer, never passing the end of
  598.        the directory length.  The application process is hung;
  599.        it can't be killed or stopped.
  600.  
  601.     IBM has closed the problem with a PRS code (Permanent
  602.     ReStriction) under AIX Version 3 and has targeted a fix
  603.     for AIX V4.2.
  604.  
  605. 3.7    Why doesn't lsof display open IRIX 5.3 XFS files properly?
  606.  
  607.     Dave Olson <olson@anchor.engr.sgi.com> who provided the
  608.     IRIX 5.3 changes to lsof, says he was unable to include
  609.     support for the new XFS file system, because of completely
  610.     different in-core data structures for XFS inodes.
  611.  
  612. 3.8    Where is the IRIX 5.3 <sys/vnode.h>?
  613.  
  614.     According to Dave Olson of SGI, <sys/vnode.h> is shipped
  615.     with IRIX 5.3 in eoe1.sw.unix.  However, during the XFS
  616.     installation or the installation of some XFS patch, it is
  617.     installed a second time.  (So far no problem.)  However,
  618.     if XFS or the XFS patch is removed, <sys/vnode.h> is removed,
  619.     too.
  620.  
  621.     Some possible solutions: 1) copy <sys/vnode.h> manually
  622.     from an IRIX 5.3 source where it still exists; or 2) mount
  623.     the IRIX 5.3 CDROM and type:
  624.  
  625.     # inst -a -f /CDROM/dist -I eoe.sw.unix -Y /usr/include/sys/vnode.h
  626.  
  627.     The second solution was suggested by John R. Vanderpool
  628.     <fish@daacdev1.stx.com>.
  629.  
  630. 3.9    Why does an HP-UX lsof compilation get ``unknown "O" option?''
  631.  
  632.     If you only have the standard HP-UX C compiler and haven't
  633.     purchased and installed the optional one, when you try to
  634.     compile lsof with the Makefile that "Configure hpux"
  635.     produces, you'll get the warning message:
  636.  
  637.         cc: error 422: unknown option "O" ignored.
  638.  
  639.     The HP-UX cc(1) man page says this:
  640.  
  641.       "Options
  642.          Note that in the following list, the cc and c89 options
  643.          -A , -G , -g , -O , -p , -v , -y , +z , and +Z are
  644.          not supported by the C compiler provided as part of
  645.          the standard HP-UX operating system.  They are supported
  646.          by the C compiler sold as an optional separate product."
  647.  
  648.     If you can't install the "optional separate product," you
  649.     can get rid of the warning message by editing the Makefile
  650.     and removing the "-O" option from the DEBUG string -- i.e.,
  651.     change
  652.  
  653.         DEBUG=    -O -DCANDOCHILD
  654.     to
  655.         DEBUG=    -DCANDOCHILD
  656.  
  657. 3.10    Why doesn't a NetBSD 1.0A binary run on my 1.0A system?
  658.  
  659.     Apparently NetBSD uname output isn't always sufficient to
  660.     identify the system on which a given lsof binary will run.
  661.     I've had trouble on an Intel system, identified as 1.0A
  662.     before and after it was updated.  A binary generated on
  663.     the earlier instance wouldn't run on the later one.
  664.  
  665.     If you get one of the pre-compiled NetBSD binaries (I don't
  666.     recommend it.), and it won't run, try building your own
  667.     binary from the sources.
  668.  
  669. 3.11    Why does an asterisk (`*') precede some inode numbers?
  670.  
  671.     An asterisk (`*') prefix on an inode number indicates the
  672.     number was too large for the output field.  Typically lsof
  673.     reserves six digits for the inode number field.  If the
  674.     inode number is larger than that, lsof prints an asterisk
  675.     and the last five digits of the inode number.
  676.  
  677.     If you have a system where inode numbers are usually larger
  678.     than six digits, please let me know.  There are two other
  679.     things you can consider:
  680.     
  681.         1.  You can change the source code to print a larger
  682.         inode number field -- look at the print_file()
  683.         function in dfile.c. The print_file() function may
  684.         come from common/prtf.frag for many dialects; check
  685.         Mksrc and dfile.c in the dialect sub-directory to
  686.         see if print_file() comes from prtf.frag.
  687.  
  688.         2.  You can specify field output (with -F, -f, and -0)
  689.         and post-process the field output to display larger
  690.         inode numbers.  The sample awk and Perl field
  691.         listing scripts do that.
  692.  
  693. 3.12    Why does the offset have ``0t' and ``0x'' prefixes?
  694.  
  695.     The offset value that appears in the SIZE/OFF column has
  696.     ``0t' and ``0x'' prefixes to distinguish it from size values
  697.     that may appear in the same column.
  698.  
  699.     If the offset value is less than 100,000,000, it appears
  700.     in decimal with a ``0t' prefix; over 99,999,999, in
  701.     hexadecimal with a ``0x'' prefix.
  702.  
  703.     A decimal offset is handy, for example, when tracking the
  704.     progress of an outbound ftp transfer.  When lsof reports
  705.     on the ftp process, it will report the size of the file
  706.     being sent with its open descriptor; it will report the
  707.     progress of the transfer via the offset of the outbound
  708.     open ftp data socket descriptor.
  709.  
  710.  
  711. 4.0    Lsof Features
  712.  
  713. 4.1     Why doesn't lsof doesn't report on /proc entries on my
  714.     system?
  715.  
  716.     /proc file system support is generally available only for
  717.     BSD, OSF, and SYSV R4 dialects.  It's also available for
  718.     Linux.
  719.  
  720.     Even on some SYSV R4 dialects I encountered many problems
  721.     while trying to incorporate /proc file system support.
  722.     The chief problem is that some vendors don't distribute
  723.     the header file that describes the /proc file system node
  724.     -- usually called prdata.h.
  725.  
  726.     I wasn't able to figure out how to provide /proc file system
  727.     support under EP/IX 2.1.1 for the CDC 4680, because of
  728.     environment conflicts.  Lsof compiles in the svr3 environment,
  729.     but some of the functions and header files it needs for
  730.     /proc file system support come from the svr4 environment.
  731.     I couldn't figure out how to mix the two.
  732.  
  733. 4.2    How do I disable the device cache file feature or alter
  734.     it's behavior?
  735.  
  736.     To disable the device cache file feature for a dialect,
  737.     remove the HASDCACHE definition from the machine.h file of
  738.     the dialect's machine.h header file.
  739.  
  740.     You can also use HASDCACHE to change the default location
  741.     of the device cache file.
  742.  
  743.     If you're worried about the presence of the mode 0666 device
  744.     cache file in your /tmp, consider these checks that lsof
  745.     makes on the file before using it:
  746.     
  747.         1.  The device cache file's modes must be 0666 and its
  748.         size non-zero.
  749.  
  750.         2.  The device cache files' mtime must be greater than
  751.         the mtime and ctime of the device directory (usually
  752.         /dev).
  753.  
  754.         3.  There must be a correctly formatted section count
  755.         line at the beginning of the file.
  756.  
  757.         4.  Each section must have a header line with a count
  758.             that properly numbers the lines in the section.
  759.         Legal sections are device, clone, pseudo-device,
  760.         and CRC.
  761.  
  762.         5.  The lines of a section must have the proper format.
  763.  
  764.         6.  All lines are included in a 16 bit CRC, and it is
  765.         recorded in a non-checksummed section line at the
  766.         end of the file.
  767.  
  768.         7.  The checksum computed when the file is read must
  769.         match the checksum recorded when the file was
  770.         written.
  771.  
  772.         8.  The checksum section line must be followed by
  773.         end-of-information.
  774.  
  775.         9.  Lsof must be able to get matching results from
  776.         stat(2) on a randomly chosen entry of the device
  777.         section.
  778.  
  779.        10.  Lsof changes the file's ownerships to the caller's
  780.         effective IDs after creating it.
  781.  
  782. 5.0    Linux
  783.  
  784. 5.1    Why doesn't lsof work on my Linux system?
  785.  
  786.     I have produced ports of lsof to two Linux versions, 1.0.9
  787.     and 1.1.47, the Yggdrasil Plug-and-Play Linux Fall '94
  788.     release.  Lsof may not work under other Linux versions,
  789.     simply because of the pace of Linux development.
  790.  
  791.     Hendrik G. Seliger <hank@Blimp.automat.uni-essen.de> reports
  792.     that lsof compiles and seems to work under Linux 1.1.61.
  793.     He used the linux1147 Configure abbreviation.
  794.  
  795.     Marty Leisner <leisner@sdsp.mc.xerox.com> reports that lsof
  796.     compiles and seems to work under Lunix 1.1.64.  He used
  797.     the linux1147 Configure abbreviation, too.  Marty later
  798.     reports that lsof 3.25 compiles and works under Linux 1.2.5,
  799.     using the linux Configure abbreviation (new at lsof 3.20);
  800.     and lsof 3.29 compiles and works under Linux 1.2.8.
  801.  
  802.     Michael Shields <shields@tembel.org> and I have tested lsof
  803.     3.32 under Linux 1.2.10.
  804.  
  805.     Lsof is a complicated application.  It probes kernel memory
  806.     and looks at kernel structures.  Linux kernel development
  807.     tends to affect both those items.  I know, for example,
  808.     that kernel memory structures changed between 1.0.9 and
  809.     1.1.47, because I had to adjust lsof for differences in
  810.     task structure elements between the two Linux versions.
  811.  
  812.     If lsof doesn't even compile on your Linux system, you may
  813.     be using a version of Linux whose header files differ from
  814.     the ones I used.  Or you may not have installed /usr/src/linux,
  815.     and lsof can't find header files that it needs from that
  816.     directory.
  817.  
  818. 5.2    Why does lsof complain about /dev/kmem?
  819.  
  820.     Lsof reads kernel information via /dev/kmem.  If you get
  821.     this error message:
  822.  
  823.         lsof: can't open /dev/kmem
  824.  
  825.     then the permissions on /dev/kmem or the authority you have
  826.     when using lsof aren't powerful enough to allow lsof to
  827.     read from it.  Often /dev/kmem is owned by the kmem or
  828.     system group and has group read permission, so lsof needs
  829.     to run setgid kmem or system, or the login that runs it
  830.     must be in the kmem or system group (that's the way I test
  831.     lsof).  So, become the super user and:
  832.  
  833.     either        $ chgrp kmem lsof
  834.     or        $ chgrp system lsof
  835.     and        $ chmod 2755 lsof
  836.  
  837. 5.3    Why can't lsof find kernel addresses?
  838.  
  839.     The failure to read kernel addresses usually is accompanied
  840.     by error messages like:
  841.  
  842.         lsof: can't read kernel name list from <file_name>
  843.         lsof: missing kernel high memory definition
  844.         lsof: missing kernel memory map definition
  845.         lsof: missing kernel memory start definition
  846.         lsof: no _task kernel definition
  847.         lsof: can't read memory parameters
  848.  
  849.     These messages describe failures in obtaining addresses
  850.     for the symbols that identify kernel structures lsof wants
  851.     to read.  Lsof obtains kernel symbol addresses from the
  852.     /zSystem.map file -- that will usually be the <file_name>
  853.     argument in the "can't read kernel name list from" error
  854.     message.  You might not have that file, or it might not be
  855.     in that place (See 5.4.)
  856.  
  857.     If you encounter kernel address access errors and find a
  858.     strategy that works, please let me know and I'll add its
  859.     description to this file.
  860.  
  861. 5.3    Why does lsof have trouble reading kernel structures?
  862.  
  863.     On my development systems with Linux 1.0.9 and 1.1.47 I
  864.     found I could read all relevant kernel structures via
  865.     /dev/kmem.  I suspect later Linux versions may require that
  866.     lsof use other memory access techniques, but I have no
  867.     system on which to test this hunch.
  868.  
  869. 5.4    Where is /zSystem.map (or /System.map)?  Why doesn't it match
  870.     my kernel?
  871.  
  872.     Lsof uses the system map file -- /zSystem.map or /System.map
  873.     -- to locate addresses of the symbols for kernel information
  874.     it needs to read.  Without this file, lsof cannot function.
  875.  
  876.     The system map file is installed automatically when you
  877.     use the kernel Makefile to install a new kernel.  If you
  878.     made a new kernel and installed it manually, you may have
  879.     forgotten to install the system map file that matches it.
  880.  
  881.     The Configure script tries to determine which system map
  882.     file to use -- /zSystem.map or /System.map -- when it
  883.     processes the linux abbreviation.  If /zSystem.map exists,
  884.     the Configure script lets lsof default to using it; if
  885.     /zSystem.map doesn't exist, but /System.map does, the
  886.     Configure script defines a symbol that causes lsof to use
  887.     it; if neither exists, Configure issues a warning and lets
  888.     lsof try to use /zSystem.map.  Garner Halloran
  889.     <kheldar@felix.cc.gatech.edu> helped me sort this out.
  890.  
  891.     Lsof revisons 3.35 and above have code, courtesy of Marty
  892.     Leisner <leisner@sdsp.mc.xerox.com>, that tries to determine
  893.     if the system map file and the booted kernel are a matched
  894.     set.  The code compares the symbol names and addresses from
  895.     the system map file to the symbol names and addresses from
  896.     /proc/ksyms.  If any matching pair of names has different
  897.     addresses, lsof complains and stops -- e.g.,
  898.  
  899.         $ lsof -k ./XXX
  900.         lsof: kernel symbol address mismatch: do_munmap
  901.               /proc/ksyms value=0x122018; ./XXX value=0x12201a
  902.               There were 161 additional mismatches.
  903.               ./XXX and the booted kernel may not be a matched set.
  904.